package com.bdv.md.controller;

import java.util.Enumeration;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/mgt_dummy")
public class MGTControllerDummy {

	@RequestMapping("/token")
	public @ResponseBody String token(HttpServletRequest req){
		return "TOKEN TEST RESPONSE<br/>"+testResponse(req);
	}
	

	@RequestMapping("/amr")
	public @ResponseBody String amr(HttpServletRequest req){
		return "AMR TEST RESPONSE<br/>"+testResponse(req);
	}

	@RequestMapping("/alarm")
	public @ResponseBody String alarm(HttpServletRequest req){
		return "ALARM TEST RESPONSE<br/>"+testResponse(req);
	}
	
	public String testResponse(HttpServletRequest req){
		String response = "";
		
		Enumeration<String> nameEnu = req.getParameterNames();
		
		while(nameEnu.hasMoreElements()){
			String name = nameEnu.nextElement();
			String value = req.getParameter(name);
			response += name+" = "+value+"<br/>";
		}
		return response;
	}
}
